<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/default.xhtml"
   xmlns:pe="http://primefaces.org/ui/extensions">
   
   	<f:metadata>
	   	<f:viewParam name="articleId" value="#{articleHome.id}"></f:viewParam>
	   	<f:event listener="#{articleHome.initConversation()}" type="preRenderView"></f:event>
   	</f:metadata>
   
   	<ui:define name="content">
   
		<h:form id="editForm">         
	       <p:messages id="messages" closable="true"><p:autoUpdate/></p:messages>
			<p:panel id="baseInfo" header="文章信息" style="margin-bottom:10px;">		        
		        <h:panelGrid columns="2" cellpadding="5">
					<p:outputLabel for="title" value="标题" />				
					<h:outputText id="title" 
							  value="#{articleHome.instance.title}"
						   required="true"
						 styleClass="input-large" />
						   
					<p:outputLabel  value="标题颜色" />				
					<p:outputLabel>
						<ui:include src="/WEB-INF/templates/outputColor.xhtml">
							<ui:param name="color" value="#{articleHome.instance.color}" />
						</ui:include>
					</p:outputLabel>
					
					<p:outputPanel>
						<p:outputLabel value="文章图片" />
					</p:outputPanel>
					<p:outputPanel>
						<div id="imgsPreview" >
							<img  data-original="#{attachmentUtils.getFullPath(articleHome.instance.image)}" src="#{attachmentUtils.getFullPath(articleHome.instance.image)}"  width="240"/>
						</div>		
					</p:outputPanel>				
					
					<p:outputLabel for="keywords" value="关键字" />				
					<h:outputText id="keywords" 
							  value="#{articleHome.instance.keywords}" />
					
					<p:outputLabel for="description" value="描述" />
					<h:outputText id="description" value="#{articleHome.instance.description}" />
					
					<p:outputLabel for="weight" value="权重" />
					<h:outputText id="weight" value="#{articleHome.instance.weight}" />	
					
					<p:outputLabel for="weightDate" value="权重日期" />
					<h:outputText id="weightDate" value="#{articleHome.instance.weightDate}" >
						<f:convertDateTime   pattern="yyyy-MM-dd"/>
					</h:outputText>		
					
					<ui:remove><p:outputLabel for="highlightTitle" value="标题高亮" />				
					<h:outputText   id="highlightTitle" 
								value="#{articleHome.instance.highlightTitle}" />
					
					<p:outputLabel for="highlightContent" value="内容高亮" />				
					<h:outputText   id="highlightContent" 
								value="#{articleHome.instance.highlightContent}" />
					</ui:remove>			
					<p:outputLabel for="link" value="外部链接" />				
					<h:outputText   id="link" 
								value="#{articleHome.instance.link}" >
					</h:outputText>
				</h:panelGrid>
			</p:panel>
			
			<p:panel id="secondInfo" header="文章附表" style="margin-bottom:10px;">		        
		        <h:panelGrid columns="2" cellpadding="5">
					<p:outputLabel for="content" value="内容" />				
					<pe:ckEditor id="content" value="#{articleHome.instance.articleData.content}" readonly="true" width="100%" required="true"></pe:ckEditor>
					<p:outputLabel for="copyfrom" value="来源" />				
					<h:outputText   id="copyfrom" 
								 value="#{articleHome.instance.articleData.copyfrom}">
					</h:outputText>
					<p:outputLabel for="allowComment" value="是否允许评论" />
					<h:outputText id="allowComment" value="#{articleHome.instance.articleData.allowComment? '是' : '否'}" />
				</h:panelGrid>
			</p:panel>
			
			
			<p:commandButton action="#{articleHome.audit()}" value="审核" ajax="false" />			
			<p:commandButton action="#{articleHome.cancel()}" value="取消" immediate="true"></p:commandButton>
		</h:form>
		
		
		
	
   	</ui:define>
</ui:composition>
